package net.app.zoneland.common.core.vo;

import lombok.Data;
import net.app.zoneland.common.core.enums.ResultCode;

/**
 * @Description 分页返回数据
 * @Author LENOVO
 * @CreateTime 2020/12/13 10:29
 * @Version: 1.0
 */
@Data
public class PageResult<T> extends Result {

    private long count;

    /**
     * 分页返回结果集
     * @param data
     * @param total
     * @param <T>
     * @return
     */
    public static <T> PageResult<T> success(T data, Long total) {
        PageResult<T> pageResult = new PageResult();
        pageResult.setCode(ResultCode.SUCCESS.getCode());
        pageResult.setMsg(ResultCode.SUCCESS.getMsg());
        pageResult.setData(data);
        pageResult.setCount(total);
        return pageResult;
    }
}
